<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>三级推广配置文件管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
			var val  = '${recommendConfig.isOpen}';
			if(val != "1"){
				val ="0";
			} 
			$("input[type='radio'][name='isOpen'][value='"+val+"']").attr("checked", "checked");
			
			var typeVal = '${recommendConfig.type}';
			if(typeVal != "1"){
				typeVal ="0";
			} 
			$("input[type='radio'][name='type'][value='"+typeVal+"']").attr("checked", "checked");
			
			
			$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/wechat/recommendConfig/">三级推广配置文件列表</a></li>
		<li class="active"><a href="${ctx}/wechat/recommendConfig/form?id=${recommendConfig.id}">三级推广配置文件<shiro:hasPermission name="wechat:recommendConfig:edit">${not empty recommendConfig.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="wechat:recommendConfig:edit">查看</shiro:lacksPermission></a></li>
		<%-- <li><a href="${ctx}/wechat/lottery/expandLotteryList?sourceId=${recommendConfig.id}&sourceType=3&type=7">三级推广奖品</a></li> --%>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="recommendConfig" action="${ctx}/wechat/recommendConfig/save" method="post" class="form-horizontal" enctype="multipart/form-data">
		<form:hidden path="id"/>
		<form:hidden path="userId"/>
		<tags:message content="${message}"/>
		
		
		<div class="control-group">
			<label class="control-label">活动标题:</label>
			<div class="controls">
				<form:input path="name" htmlEscape="false"  class="required"/>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">类型:</label>
			<div class="controls">
				<input type="radio" name="type"  value="0" />积分兑奖品	&nbsp;&nbsp;
				<input type="radio" name="type"  value="1" />积分排名送奖品
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">是否增送积分:</label>
			<div class="controls">
				<input type="radio" name="isOpen"  value="1" />是 &nbsp;&nbsp;<input type="radio" name="isOpen"  value="0" />否
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">积分兑换数量:</label>
			<div class="controls">
				<form:input path="exchangeNum" htmlEscape="false"  class="required number"/><span class="alert">0为不限，积分排名送奖品可以不用设置</span>
			</div>
		</div>
		
		
		<script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
		<div class="control-group">
			<label class="control-label">开始时间:</label>
			<div class="controls">
				<input id="startTime" name="startTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${recommendConfig.startTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
				
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">结束时间:</label>
			<div class="controls">
				<input id="endTime" name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate required"
						value="<fmt:formatDate value="${recommendConfig.endTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">关注会员积分:</label>
			<div class="controls">
				<form:input path="oneselfScore" htmlEscape="false"  class="required number"/><span class="alert">请填写整数</span>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">上级会员所得积分:</label>
			<div class="controls">
				<form:input path="parentScore" htmlEscape="false"  class="required number"/><span class="alert">请填写整数</span>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">上上级会员所得积分:</label>
			<div class="controls">
				<form:input path="grandScore" htmlEscape="false"  class="required number"/><span class="alert">请填写整数</span>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">排名显示数量:</label>
			<div class="controls">
				<form:input path="rankNum" htmlEscape="false"  class="required number"/>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">推广海报上的背景图:</label>
			<div class="controls">
				
				<c:if test="${recommendConfig.recommendPic ne '' && recommendConfig.recommendPic ne null}">
					<div class="control"><img src="${ctxUser }/recommend/${recommendConfig.recommendPic }" style="width: 150px; height: 200px;"/></div>
				</c:if>
				<div class="control">
					<input type="file" name="picFile" htmlEscape="false" /><label style="color:red;">图片尺寸为640*960</label>
				</div>
				<div class="control">
					<input type="button" value="查看背景图样例" onclick="javascript:window.location.href='http://www.hdchangbao.com//zxims/userfiles/recommend/weixin_recommend_1458958871921.jpg'"/>
				</div>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">二维码X轴:</label>
			<div class="controls">
				<form:input path="qrcodeX" htmlEscape="false"  class="required number"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">二维码Y轴:</label>
			<div class="controls">
				<form:input path="qrcodeY" htmlEscape="false"  class="required number"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">二维码高宽:</label>
			<div class="controls">
				<form:input path="qrcodeWH" htmlEscape="false"  class="required number"/>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">头像X轴:</label>
			<div class="controls">
				<form:input path="headimgX" htmlEscape="false"  class="required number"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">头像Y轴:</label>
			<div class="controls">
				<form:input path="headimgY" htmlEscape="false"  class="required number"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">头像高宽:</label>
			<div class="controls">
				<form:input path="headimgWH" htmlEscape="false"  class="required number"/>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">排行榜图片:</label>
			<div class="controls">
				
				<c:if test="${recommendConfig.rankPic ne '' && recommendConfig.rankPic ne null}">
					<div class="control"><img src="${ctxUser }/recommend/${recommendConfig.rankPic }" style="width: 150px; height: 100px;"/></div>
				</c:if>
				<div class="control">
					<input type="file" name="picFile1" htmlEscape="false" />
				</div>
			</div>
		</div>
		
		<%-- 
		<div class="control-group">
			<label class="control-label">推广海报上的广告词:</label>
			<div class="controls">
				<form:textarea path="recommendWords" htmlEscape="false" rows="3" cols="5" class="required"/> 
			</div>
		</div>
		 --%>
		
		<div class="control-group">
			<label class="control-label">推广海报前发送的消息内容:</label>
			<div class="controls">
				<form:textarea path="message" htmlEscape="false" rows="3" cols="5" class="required"/>
				<label style="color:red;">请填写：‘endTime’，表示海报结束时间</label>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">获得积分消息内容:</label>
			<div class="controls">
				<form:textarea path="scoreMessage" htmlEscape="false" rows="3" cols="5" /> 
				<label style="color:red;">请填写：‘oneselfScore’，表示关注平台得到积分</label>
			</div>
		</div>
		
		
		<div class="control-group">
			<label class="control-label">上级获得积分后，下级收到的消息:</label>
			<div class="controls">
				<form:textarea path="parentMessage" htmlEscape="false" rows="3" cols="5" /> 
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">已是会员[重复关注]的消息:</label>
			<div class="controls">
				<form:textarea path="repetitionMessage" htmlEscape="false" rows="3" cols="5" class="required"/> 
				<label style="color:red;">请填写：‘memberName’，表示会员名称</label>
			</div>
		</div>
		
		
		<div class="control-group">
			<label class="control-label">新手帮助文档:</label>
			<div class="controls">
				<form:textarea id="newHelp" htmlEscape="true"  path="newHelp" rows="4" maxlength="100000" class="input-xlarge required"/>
				<tags:ckeditor replace="newHelp" uploadPath="/project" />
			</div>
		</div>
		
		
		<div class="form-actions">
			<shiro:hasPermission name="wechat:recommendConfig:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>
